package day5.chongwu;

import day5.chongwu.bird.Parrot;

/**
 * @author oldliu
 * @since 1.0
 */
public class PetDoctor {
    private String name;

    public PetDoctor(String name) {
        this.name = name;
    }

    //    public void cure(Dog d){
//        while (d.getHealth()<70){
//            System.out.println("给"+d.getName()+"做检查");
//            System.out.println("打针吃药。。。");
//            System.out.println("好了");
//            d.setHealth(d.getHealth()+20);
//        }
//        System.out.println("你没病了，没病走两步！");
//    }
//    public void cure(Parrot d){
//        while (d.getHealth()<70){
//            System.out.println("给"+d.getName()+"做检查");
//            System.out.println("打针吃药。。。");
//            System.out.println("好了");
//            d.setHealth(d.getHealth()+20);
//        }
//        System.out.println("你没病了，没病走两步！");
//    }
//    public void cure(Cat d){
//        while (d.getHealth()<70){
//            System.out.println("给"+d.getName()+"做检查");
//            System.out.println("打针吃药。。。");
//            System.out.println("好了");
//            d.setHealth(d.getHealth()+20);
//        }
//        System.out.println("你没病了，没病走两步！");
//    }
    //如果来的是老虎Tiger,把嘴捆上。。。
    public void cure(Pet d) {
        if(d instanceof  Tiger){
            System.out.println("把嘴捆上");
        }
        while (d.getHealth() < 70) {
            System.out.println("给" + d.getName() + "做检查");
            System.out.println("打针吃药。。。");
            System.out.println("好了");
            d.setHealth(d.getHealth() + 20);
        }
        System.out.println("你没病了，没病走两步！");
    }
}
